<?php
/**
 * Usage example for Image_Graph.
 * 
 * Main purpose: 
 * Show dot/scatter chart
 * 
 * Other: 
 * None specific
 * 
 * $Id: plot_scatter.php,v 1.4 2005/08/03 21:21:52 nosey Exp $
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <pear.nosey@veggerby.dk>
 */
//include Graph.php and Canvas.php
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';

//create a canvas
$Canvas = & Image_Canvas::factory('svg', array('width' => 900, 'height' => 400));
$Graph =& Image_Graph::factory('graph', $Canvas);
/*
require_once 'Image/Graph.php';

// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300)); 
// add a TrueType font
//$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
//$Font->setSize(8);

//$Graph->setFont($Font);
*/
$Graph->add(
    Image_Graph::vertical(
        Image_Graph::factory('title', array('Dot Chart Sample', 14)),        
        Image_Graph::vertical(
            $Plotarea = Image_Graph::factory('plotarea','axis'),
            $Legend = Image_Graph::factory('legend'),
            90
        ),
        5
    )
);
$Legend->setPlotarea($Plotarea);        
$Axis =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$Axis->forceMaximum(120);  
$Axis->forceMinimum(0);  
$Axis->setLabelInterval(10);  
// create the dataset
//$Dataset1 =& Image_Graph::factory('random', array(10, 2, 9, false));

$Dataset1 =& Image_Graph::factory('dataset'); 
$Dataset1->addPoint(100, 10); 
$Dataset1->addPoint(3, 3); 
$Dataset1->addPoint(8, 8); 
$Dataset1->addPoint(5, 5);


// create the 1st plot as smoothed area chart using the 1st dataset
$Plot1 =& $Plotarea->addNew('Image_Graph_Plot_Dot', array(&$Dataset1));
$Marker1 =& Image_Graph::factory('Image_Graph_Marker_Circle');
$Marker1->setFillColor('white');
$Marker1->setLineColor('black');
$Marker1->setSize(4);
// set a line color
$Plot1->setMarker($Marker1);
$Plot1->setTitle('Introvert');
/*
// create the dataset
$Dataset2 =& Image_Graph::factory('random', array(10, 10, 15, false));
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot2 =& $Plotarea->addNew('Image_Graph_Plot_Dot', array(&$Dataset2));
$Marker2 =& Image_Graph::factory('Image_Graph_Marker_Plus');
$Marker2->setFillColor('green');
$Marker2->setLineColor('black');
// set a line color
$Plot2->setMarker($Marker2);
$Plot2->setTitle('Extrovert');
*/
// output the Graph
$Graph->done();
?> 
